package com.example.validatestudy.demos.tread.nosafe;

public class NoSafeTest extends Thread {
    public static int amount = 0;
    /**
     * 有可能都读到 amount=0 ，最终结果为1
     * @param args
     */
    public static void main(String[] args) {
        NoSafeTest thread = new NoSafeTest();
        thread.start();
        System.out.println(amount);
        amount++;
        System.out.println(amount);
    }
    public void run() {
        amount++;
    }
}
